n = int(input())
max=0
min=100
while n>0:
    x = eval(input())
    if x > max:
        max = x
    if x < min:
        min = x
    n -= 1
print(max)
print(min)
